# views.py: 路由 + 视图函数

from flask import Blueprint
from models import *

# 蓝图
blue = Blueprint('user', __name__)


@blue.route('/')
def index():
    return 'index'


@blue.route('/useradd/')
def user_add():
    # 一个用户添加
    u = User()
    u.name = '张三'
    u.age = 30
    u.salary = 1000
    u.sex = 1

    db.session.add(u)
    db.session.commit()

    return 'add successfully'
